﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;

namespace TravelexForwardContract
{
    public partial class AllReportForm : Form
    {
        private XDatabaseOperation m_xDbOp;

        public AllReportForm()
        {
            InitializeComponent();
            m_xDbOp = new XDatabaseOperation();

        }

        private void buttonClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void buttonBrowse_Click(object sender, EventArgs e)
        {
            using (FolderBrowserDialog browseDialog = new FolderBrowserDialog())
            {
                DialogResult result = browseDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    textBoxPath.Clear();
                    textBoxPath.Text = browseDialog.SelectedPath;
                }

                this.checkPath();
            }  
        }

        private void buttonSearchAndPrint_Click(object sender, EventArgs e)
        {


        }

        private void checkPath()    
        {
            String strPath = textBoxPath.Text;
            if (strPath == "")
            {
                MessageBox.Show("Please select valid path", "Invalid Path",
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            if (!Directory.Exists(strPath))
            {
                MessageBox.Show("Directory does not exist", "Invalid Path",
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

        }
    }
}
